import request from '@/utils/request.js';


 //根据碳类型查询
export function getCarbonList(type) {
  return request({
    url: '/carbon//queryCarbonByType',
    method: 'get',
    params: {
      type: type
    }
  });
}

//后台给出建议
export function getAdvice(name,value,unit,result) {
  return request({
    url: '/carbon/getAdvice',
    method: 'get',
     params: {
       name: name,
       value: value,
       unit: unit,
       result: result
     }
  });
}
//保存记录
export function saveRecord(data) {
  return request({
    url: '/carbon/saveRecord',
    method: 'post',
    data: data
  });
}
//获取记录
export function getRecord(userId,type) {
  return request({
    url: '/carbon/queryCarbonRecord',
    method: 'get',
     params: {
       userId: userId,
       type: type
     }
  });
}
//导出
export function exportRecord(userId,username) {
  return request({
    url: '/carbon/exportExcel',
    method: 'get',
     params: {
       userId: userId,
       username: username
     },
    responseType: 'blob'
  });
}